/////precompiled////////
#include "precompiled.h"
////////////////////////


#include "frm_filler.h"
using namespace frm;
using namespace filler;

// TBaseArray /////////////////////////////////////////////////////////////////

//
void TBaseArray::CopyFrom(TBaseArray &V)
{
	Clear(); 
	
	for (int N = 0; N < V.Count(); N++) {
		TBase *From = &V[N]; bool EnDelete = V.a.GetEnDelete(N);

		if (EnDelete) {
			From = From->TBase_NewCopy();
		}
		Add(From,EnDelete);
	}
}

// TColor /////////////////////////////////////////////////////////////////////

//
void TColor::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Paint.DC.FillRect(Paint.GRect.RThisVisible,grf::TBrush(Value));
}

//
svl::TInfoParam TColor::AddInfoTo(svl::TInfoParam Info)
{
	return TBase::AddInfoTo(Info)
	 .Add("Value",Value)
	;
}

// TLineVertCenter ////////////////////////////////////////////////////////////

//           
void TLineVertCenter::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X  = Paint.GRect.RThis.Left + Paint.GRect.RThis.Width/2;
	int Y1 = Paint.GRect.RThisVisible.Top;
	int Y2 = Paint.GRect.RThisVisible.Bottom();

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X,Y1);
	Paint.DC.LineTo(X,Y2);
}

// TLineVertRight /////////////////////////////////////////////////////////////

//
void TLineVertRight::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X  = Paint.GRect.RThis.Left + max(0,Paint.GRect.RThis.Width - 1);
	int Y1 = Paint.GRect.RThisVisible.Top;
	int Y2 = Paint.GRect.RThisVisible.Bottom();

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X,Y1);
	Paint.DC.LineTo(X,Y2);
}

// TLineVertLeft //////////////////////////////////////////////////////////////

//
void TLineVertLeft::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X  = Paint.GRect.RThis.Left;
	int Y1 = Paint.GRect.RThisVisible.Top;
	int Y2 = Paint.GRect.RThisVisible.Bottom();

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X,Y1);
	Paint.DC.LineTo(X,Y2);
}

// TLineHorzTop ///////////////////////////////////////////////////////////////

//
void TLineHorzTop::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X1 = Paint.GRect.RThisVisible.Left;
	int X2 = Paint.GRect.RThisVisible.Right();
	int Y  = Paint.GRect.RThis.Top;

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X1,Y);
	Paint.DC.LineTo(X2,Y);
}

// TLineHorzBottom ////////////////////////////////////////////////////////////

//
void TLineHorzBottom::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X1 = Paint.GRect.RThisVisible.Left;
	int X2 = Paint.GRect.RThisVisible.Right();
	int Y  = Paint.GRect.RThis.Bottom()-1;

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X1,Y);
	Paint.DC.LineTo(X2,Y);
}

// TLineHorzCenter ////////////////////////////////////////////////////////////

//
void TLineHorzCenter::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	int X1 = Paint.GRect.RThisVisible.Left;
	int X2 = Paint.GRect.RThisVisible.Right();
	int Y  = Paint.GRect.RThis.Top + Paint.GRect.RThis.Height/2;

	Paint.DC.Select(Pen);
	Paint.DC.MoveTo(X1,Y);
	Paint.DC.LineTo(X2,Y);
}

// TFrameRect /////////////////////////////////////////////////////////////////

//
void TFrameRect::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Paint.DC.FrameRect(Paint.GRect.RThis,grf::TBrush(Value));
}

//
svl::TInfoParam TFrameRect::AddInfoTo(svl::TInfoParam Info)
{
	return TBase::AddInfoTo(Info)
	 .Add("Value",Value);
}

// TColorLevel ////////////////////////////////////////////////////////////////

//
void TColorLevel::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Paint.DC.FillRect(
		Paint.GRect.RThisVisible,grf::TBrush(
			grf::TColor(
				Component.CalcNumLevel()*35,0,100+Component.CalcNumLevel()*30
			)
		)
	);
}

// TColorLevelFrame ///////////////////////////////////////////////////////////

//
void TColorLevelFrame::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	if (Paint.GRect.RThis.Equal(Paint.GRect.RThisVisible))
	{
		grf::TRect R = Paint.GRect.RThisVisible;
			R.Left++; R.Top++; R.Width-=2; R.Height-=2;

		Paint.DC.FillRect(
			R,grf::TBrush(
				grf::TColor(
					Component.CalcNumLevel()*35,0,100+Component.CalcNumLevel()*30
				)
			)
		);
		Paint.DC.FrameRect(Paint.GRect.RThisVisible,grf::TBrush(FrameColor));
	}
	else
	{
		Paint.DC.FillRect(
			Paint.GRect.RThisVisible,grf::TBrush(
				grf::TColor(
					Component.CalcNumLevel()*35,0,100+Component.CalcNumLevel()*30
				)
			)
		);
		Paint.DC.FrameRect(Paint.GRect.RThis,grf::TBrush(FrameColor));
	}

//  else
//  {
//    grf::TRect     RMem(Paint.GRect.RThis.Size());
//    grf::TMemoryDC MemDC(Paint.DC,RMem.Size());
//
//    grf::TRect R = RMem;
//      R.Left++; R.Top++; R.Width-=2; R.Height-=2;
//
//    MemDC.FillRect
//    (
//      R,
//      grf::TBrush
//      (
//        grf::TColor
//        (
//          Component->CalcNumLevel()*35,0,100+Component->CalcNumLevel()*30
//        )
//      )
//    );
//    MemDC.FrameRect(RMem,grf::TBrush(FrameColor));
//
//    MemDC.CopyTo
//    (
//      Paint.GRect.RThisVisible,Paint.DC,
//      Paint.GRect.RThisVisible.LeftTop() - Paint.GRect.RThis.LeftTop()
//    );
//  }
}

// TRoundRect /////////////////////////////////////////////////////////////////

//
void TRoundRect::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Paint.DC.Select(Pen);
	Paint.DC.Select(Brush);
	Paint.DC.RoundRect(Paint.GRect.RThis,grf::TSize(8,8));
}

// TArray /////////////////////////////////////////////////////////////////////

//
void TArray::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	for (int N = 0; N < a.Count(); N++) {
		a[N].TBase_Paint(Component,Paint);
	}
}

//
bool TArray::TBase_IsTransparent()
{
	for (int N = 0; N < a.Count(); N++) {
		if (!a[N].TBase_IsTransparent()) { 
			return false;
		}
	}
	return true;
}

//
svl::TInfoParam TArray::AddInfoTo(svl::TInfoParam Info_)
{
	svl::TInfoParam Info = svl::TPointer::AddInfoTo(Info_);
	//svl::TInfoParam Info = Info_;//TBase::AddInfoTo(Info_);

	for (int N = 0; N < a.Count(); N++) {
		Info.Add(
			svl::TString() << "Array[" << N << "]",
			a[N]
		);
	}
	return Info;
}

// TArrayMemDC ////////////////////////////////////////////////////////////////

//
void TArrayMemDC::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	grf::TRect     RMem (Paint.GRect.RThis.Size());
	grf::TMemoryDC MemDC(Paint.DC,RMem.Size());

	TPaint MemPaint;
		MemPaint.DC                 = MemDC;
		MemPaint.GRect.RThis        = RMem;
		MemPaint.GRect.RThisVisible = RMem;

	for (int N = 0; N < a.Count(); N++) {
		a[N].TBase_Paint(Component,MemPaint);
	}

	MemDC.CopyTo(
		Paint.GRect.RThisVisible,Paint.DC,
		Paint.GRect.RThisVisible.LeftTop() - Paint.GRect.RThis.LeftTop()
	);
}

//
bool TArrayMemDC::TBase_IsTransparent()
{
	for (int N = 0; N < a.Count(); N++) {
		if (!a[N].TBase_IsTransparent()) { 
			return false;
		}
	}
	return true;
}

// TFillImage /////////////////////////////////////////////////////////////////

//
void TFillImage::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	grf::TRect RFill = Paint.GRect.RThis;
	grf::TRect R(RFill.Left,RFill.Top,Image.Width(),Image.Height());

//Gdiplus::Graphics Graphics(Paint.DC);
//Gdiplus::CachedBitmap cBitmap(Image.GetImage(),&Graphics);

//HBITMAP HBmp; Image.GetImage()->GetHBITMAP(Gdiplus::Color(),&HBmp);

	if (Image.IsTransparent())
	{
		while (TRUE)
		{
			while (TRUE)
			{
				R.Width  = min(R.Width ,RFill.Width );
				R.Height = min(R.Height,RFill.Height);

				if (R.IsIntersect(Paint.GRect.RThisVisible))
				{
					if (R.IsIntersect(Paint.RClientPaint))
						{ Image.TImage_Draw(Paint.DC,R);}
				}
				R.Left += Image.Width(); if (R.Left > RFill.Right()) { break;}
			}
			R.Left = RFill.Left; R.Width = Image.Width();
			R.Top += Image.Height(); if (R.Top > RFill.Bottom()) { break;}
		}
	}
	else
	{
		grf::TMemoryDC MemDC(Paint.DC,grf::TSize()); MemDC.Select(Image.GetHBitmap());

		while (TRUE)
		{
			while (TRUE)
			{
				R.Width  = min(R.Width ,RFill.Width );
				R.Height = min(R.Height,RFill.Height);

				if (R.IsIntersect(Paint.GRect.RThisVisible))
				{
					if (R.IsIntersect(Paint.RClientPaint))
						//{ Image.TImage_Draw(Paint.DC,R);}
						//{ Graphics.DrawCachedBitmap(&cBitmap,R.Left,R.Top);}
						{ MemDC.CopyTo(R,Paint.DC,grf::TPoint(0,0));}
				}
				R.Left += Image.Width(); if (R.Left > RFill.Right()) { break;}
			}
			R.Left = RFill.Left; R.Width = Image.Width();
			R.Top += Image.Height(); if (R.Top > RFill.Bottom()) { break;}
		}
	}
	
/******************************
	else
	{
		Except("TBase_Paint");
		grf::TMemoryDC MemDC(Paint.DC,grf::TSize()); MemDC.Select(Image);

		while (TRUE)
		{
			while (TRUE)
			{
				R.Width  = min(R.Width ,RFill.Width );
				R.Height = min(R.Height,RFill.Height);

				if (R.IsIntersect(Paint.GRect.RThisVisible))
				{
					if (R.IsIntersect(Paint.RClientPaint))
					{
						MemDC.CopyTo(R,Paint.DC,grf::TPoint(0,0));
					}
				}

				R.Left += Image.Width(); if (R.Left > RFill.Right())
				{
					break;
				}
			}

			R.Left = RFill.Left; R.Width = Image.Width();

			R.Top += Image.Height(); if (R.Top > RFill.Bottom())
			{
				break;
			}
		}
	}
****************************/
//  Bitmap.TBitmap_Draw(Paint.DC,Paint.GRect.RThis);
//  Paint.DC.FillRect(Paint.GRect.RThis,grf::TBrush(Bitmap));
}

// TImage /////////////////////////////////////////////////////////////////////

//
void TImage::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Image.TImage_Draw(Paint.DC,Paint.GRect.RThis);
}

// TImageCenter ///////////////////////////////////////////////////////////////

//
void TImageCenter::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	grf::TPoint Offs;
		Offs.X = (Paint.GRect.RThis.Width  - Image.Width ())/2;
		Offs.Y = (Paint.GRect.RThis.Height - Image.Height())/2;

	grf::TRect RTo = Paint.GRect.RThis;//Visible;
		RTo.OffsLeftTop(Offs);

	Image.TImage_Draw(Paint.DC,RTo);
}

// TImageBorderOld ///////////////////////////////////////////////////////////////

//
void DrawHorz( grf::TImageGdiP *Img, grf::TRect &RTo, int Right, TPaint &Paint ){
	grf::TPoint Offs;
	Offs.X = Img->Width();
	Offs.Y = 0;
	while( RTo.Left < Right /*- Offs.X*/ ){
		Img->TImage_Draw(Paint.DC,RTo);
		RTo.OffsLeftTop(Offs);
	}
}
void DrawVert( grf::TImageGdiP *Img, grf::TRect &RTo, int Bottom, TPaint &Paint ){
	grf::TPoint Offs;
	Offs.X = 0;
	Offs.Y = Img->Height();
	while( RTo.Top < Bottom /*- Offs.Y*/ ){
		Img->TImage_Draw(Paint.DC,RTo);
		RTo.OffsLeftTop(Offs);
	}
}
void DrawSquare( grf::TImageGdiP *Img, grf::TRect &RTo, int Right,int Bottom, TPaint &Paint ){
	grf::TPoint Offs;
	int VOff=0;
	while( RTo.Left < Right /*- Offs.X*/ ){
		Offs.X = 0;
		Offs.Y = Img->Height();
		while( RTo.Top < Bottom /*- Offs.Y*/ ){
			Img->TImage_Draw(Paint.DC,RTo);
			RTo.OffsLeftTop(Offs);
			VOff += Offs.Y;
		}
		Offs.X = Img->Width();
		Offs.Y = -VOff;
		VOff = 0;
		RTo.OffsLeftTop(Offs);
	}
}

void TImageBorderOld::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	grf::TPoint Offs;
	grf::TRect RTo;
	
	//top
	if( Images[0] ){
		RTo = Paint.GRect.RThis;
		Offs.X = Images[0]->Width();
		Offs.Y = 0;
		RTo.OffsLeftTop( Offs );
		DrawHorz( Images[1], RTo, RTo.Right()-Images[2]->Width(), Paint );
	}
	//center
	if( Images[8] ){
		RTo = Paint.GRect.RThis;
		Offs.X = Images[6]->Width();;
		Offs.Y = Images[0]->Height();
		RTo.OffsLeftTop(Offs);
		DrawSquare( Images[8], RTo, RTo.Right()-Images[2]->Width()
															, RTo.Bottom()-Images[4]->Height(), Paint );
	}
	//bottom
	if( Images[1] ){
		RTo = Paint.GRect.RThis;
		Offs.X = Images[6]->Width();
		Offs.Y = RTo.Height - Images[5]->Height();
		RTo.OffsLeftTop( Offs );
		DrawHorz( Images[5], RTo, RTo.Right()-Images[4]->Width(), Paint );
	}
	//left
	if( Images[2] ){
		RTo = Paint.GRect.RThis;
		Offs.X = 0;
		Offs.Y = Images[0]->Height();
		RTo.OffsLeftTop( Offs );
		DrawVert( Images[7], RTo, RTo.Bottom()-Images[6]->Height(), Paint );
	}
	//right
	if( Images[3] ){
		RTo = Paint.GRect.RThis;
		Offs.X = RTo.Width - Images[3]->Width();
		Offs.Y = Images[2]->Height();
		RTo.OffsLeftTop( Offs );
		DrawVert( Images[3], RTo, RTo.Bottom()-Images[4]->Height(), Paint );
	}

	//top-left
	if( Images[4] ){
		RTo = Paint.GRect.RThis;
		Offs.X = 0;
		Offs.Y = 0;
		RTo.OffsLeftTop(Offs);
		Images[0]->TImage_Draw(Paint.DC,RTo);
	}
	//top-right
	if( Images[5] ){
		RTo = Paint.GRect.RThis;
		Offs.X = RTo.Width - Images[2]->Width();
		Offs.Y = 0;
		RTo.OffsLeftTop(Offs);
		Images[2]->TImage_Draw(Paint.DC,RTo);
	}
	//bottom-right
	if( Images[6] ){
		RTo = Paint.GRect.RThis;
		Offs.X = RTo.Width  - Images[4]->Width();
		Offs.Y = RTo.Height - Images[4]->Height();
		RTo.OffsLeftTop(Offs);
		Images[4]->TImage_Draw(Paint.DC,RTo);
	}
	//bottom-left
	if( Images[7] ){
		RTo = Paint.GRect.RThis;
		Offs.X = 0;
		Offs.Y = RTo.Height - Images[6]->Height();
		RTo.OffsLeftTop(Offs);
		Images[6]->TImage_Draw(Paint.DC,RTo);
	}
	
}

bool TImageBorderOld::TBase_IsTransparent(){
	for( int i = 0; i < 9; i++ ){
		if( Images[i] ){
			if( Images[i]->IsTransparent() )
				return true;
		}
		else
			return true;
	}
	return false;
}

// TImageBorder /////////////////////////////////////////
void TImageBorder::DrawHorzT( grf::TRect &RTo, TPaint &Paint ){
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	r1.Y = (Gdiplus::REAL)RTo.Top;
	r1.Width = (Gdiplus::REAL)ImageMain->Width() - r - l;
	r1.Height = (Gdiplus::REAL)t;
	int n = l;
	while( n < RTo.Width ){
		r1.X = (Gdiplus::REAL)RTo.Left + n;
		Graphics.DrawImage( Bitmap, r1, (Gdiplus::REAL)l, 0, r1.Width, (Gdiplus::REAL)t, Gdiplus::UnitPixel );
		n += (int)r1.Width;
	}
}
void TImageBorder::DrawHorzB( grf::TRect &RTo, TPaint &Paint ){
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	r1.Y = (Gdiplus::REAL)RTo.Bottom() - b;
	r1.Width = (Gdiplus::REAL)ImageMain->Width() - r - l;
	r1.Height = (Gdiplus::REAL)b;
	int n = l;
	while( n < RTo.Width ){
		r1.X = (Gdiplus::REAL)RTo.Left + n;
		Graphics.DrawImage( Bitmap, r1, (Gdiplus::REAL)l, (Gdiplus::REAL)ImageMain->Height() - b, r1.Width, (Gdiplus::REAL)b, Gdiplus::UnitPixel );
		n += (int)r1.Width;
	}
}
void TImageBorder::DrawVertL( grf::TRect &RTo, TPaint &Paint ){
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	r1.X = (Gdiplus::REAL)RTo.Left;
	r1.Width = (Gdiplus::REAL)l;
	r1.Height = (Gdiplus::REAL)ImageMain->Height() - t - b;
	int n = t;
	while( n < RTo.Height ){
		r1.Y = (Gdiplus::REAL)RTo.Top + n;
		Graphics.DrawImage( Bitmap, r1, 0, (Gdiplus::REAL)t, (Gdiplus::REAL)l, r1.Height, Gdiplus::UnitPixel );
		n += (int)r1.Height;
	}
}
void TImageBorder::DrawVertR( grf::TRect &RTo, TPaint &Paint ){
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	r1.X = (Gdiplus::REAL)RTo.Right() - r;
	r1.Width = (Gdiplus::REAL)r;
	r1.Height = (Gdiplus::REAL)ImageMain->Height() - t - b;
	int n = t;
	while( n < RTo.Height ){
		r1.Y = (Gdiplus::REAL)RTo.Top + n;
		Graphics.DrawImage( Bitmap, r1, (Gdiplus::REAL)ImageMain->Width() - r, (Gdiplus::REAL)t, (Gdiplus::REAL)l, r1.Height, Gdiplus::UnitPixel );
		n += (int)r1.Height;
	}
}
void TImageBorder::DrawSquare( grf::TRect &RTo, TPaint &Paint ){
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	r1.Width = (Gdiplus::REAL)ImageMain->Width() - l - r;
	r1.Height = (Gdiplus::REAL)ImageMain->Height() - t - b;
	while( r1.X < RTo.Right() ){
		while( r1.Y < RTo.Bottom() ){
			Graphics.DrawImage( Bitmap, r1, (Gdiplus::REAL)l, (Gdiplus::REAL)t, r1.Width, r1.Height, Gdiplus::UnitPixel );
			r1.Y += r1.Height;
		}
		r1.X += r1.Width;
		r1.Y = (Gdiplus::REAL)RTo.Top + t;
	}
}

void TImageBorder::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	grf::TRect RTo = Paint.GRect.RThis;
	Gdiplus::Bitmap *Bitmap =  ImageMain->GetImage();
	Gdiplus::Graphics Graphics(Paint.DC);
	Gdiplus::RectF r1;
	
	// middle
	if( multi )
		DrawSquare( RTo, Paint );
	
	// top
	DrawHorzT( RTo, Paint );

	// bottom
	DrawHorzB( RTo, Paint );

	// left
	DrawVertL( RTo, Paint );

	// right
	DrawVertR( RTo, Paint );

	// top-left
	r1.X = (Gdiplus::REAL)RTo.Left;
	r1.Y = (Gdiplus::REAL)RTo.Top;
	r1.Width = (Gdiplus::REAL)l;
	r1.Height = (Gdiplus::REAL)t;
	Graphics.DrawImage( Bitmap, r1, 0,0,(Gdiplus::REAL)l,(Gdiplus::REAL)t, Gdiplus::UnitPixel );	
	
	// top-right
	r1.X = (Gdiplus::REAL)RTo.Right() - r;
	r1.Y = (Gdiplus::REAL)RTo.Top;
	r1.Width = (Gdiplus::REAL)r;
	r1.Height = (Gdiplus::REAL)t;
	Graphics.DrawImage( Bitmap, r1, (Gdiplus::REAL)ImageMain->Width() - r, 0, (Gdiplus::REAL)r, (Gdiplus::REAL)t, Gdiplus::UnitPixel );
		
	// bottom-left
	r1.X = (Gdiplus::REAL)RTo.Left;
	r1.Y = (Gdiplus::REAL)RTo.Bottom() - b;
	r1.Width = (Gdiplus::REAL)l;
	r1.Height = (Gdiplus::REAL)b;
	Graphics.DrawImage(Bitmap, r1, 0, (Gdiplus::REAL)ImageMain->Height() - b, (Gdiplus::REAL)l, (Gdiplus::REAL)b, Gdiplus::UnitPixel );
	
	// bottom-right
	r1.X = (Gdiplus::REAL)RTo.Right() - r;
	r1.Y = (Gdiplus::REAL)RTo.Bottom() - b;
	r1.Width = (Gdiplus::REAL)l;
	r1.Height = (Gdiplus::REAL)b;
	Graphics.DrawImage(Bitmap, r1, (Gdiplus::REAL)ImageMain->Width() - r, (Gdiplus::REAL)ImageMain->Height() - b, (Gdiplus::REAL)r, (Gdiplus::REAL)b, Gdiplus::UnitPixel );
}

bool TImageBorder::TBase_IsTransparent(){
	return ImageMain->IsTransparent();
}

// TOddEven ///////////////////////////////////////////////////////////////////

//
void TOddEven::TBase_Paint(TComponent &Component,TPaint &Paint)
{
	Except("TBase_Paint");
/*********
	TPaint::TVisibleIndex *VI = Component.TComponent_GetVisibleIndex(); if (VI)
	{
		if (div(VI->Index,2).rem == 0)
			{ Paint.DC.FillRect(Paint.GRect.RThisVisible,grf::TBrush(Odd));}
		else
			{ Paint.DC.FillRect(Paint.GRect.RThisVisible,grf::TBrush(Even));}

Paint.DC.DrawText(Paint.GRect.RThis,svl::TString(VI->Index),grf::TDC::ETextAlign_Left);

	}
*********/
}

// TFiller ////////////////////////////////////////////////////////////////////

//
void TFiller::SetOrAdd(const TBase &V)
{
	if (!base) {
		Set(V);
	}
	else {
		TArray *Array = dynamic_cast<TArray*>(base); 
		
		if (Array) {
			Array->Add(V);
		}
		else {
			TBase *Old = base; 
			base = NULL;
			Set(TArray().Add(*Old).Add(V));
			delete Old;
		}
	}
}

//
void TFiller::SetFromParent(TFiller &V) { 
	if (!base) {
		Set(V);
	}
}

//
svl::TInfoParam TFiller::AddInfoTo(svl::TInfoParam Info_)
{ 
	svl::TInfoParam Info = svl::TPointer::AddInfoTo(Info_);
	
	//if (base) {
		Info.AddExpand("base",base);
	//}
	return Info;
}
